	<template>
		<!-- 用章流程表单 -->
		<view class="container">
			<u-form :model="form" ref="uForm" label-width="200">
			  <u-form-item label="任务名称"
			    ><u-input v-model="form.name" disabled
			  /></u-form-item>
			  <u-form-item label="所属流程"
			    ><u-input v-model="form.belong" disabled
			  /></u-form-item>
			  <u-form-item label="用章负责人"
			    ><u-input v-model="formData.sealName" disabled
			  /></u-form-item>
			  <u-form-item label="委托人"
			    ><u-input v-model="form.client" disabled
			  /></u-form-item>
			  <u-form-item label="流程发起人"
			    ><u-input v-model="form.initiator" disabled
			  /></u-form-item>
			  <u-form-item label="优先级"
			    ><u-input v-model="form.priority" disabled class="input-color"
			  /></u-form-item>
			  <u-form-item label="状态"
			    ><u-input v-model="form.status" disabled
			  /></u-form-item>
			  <u-form-item label="用章类别">
			    <u-input v-model="formData.sealTypeName" disabled/>
			  </u-form-item>
			  <u-form-item label="用章开始时间">
			    <u-input v-model="formData.sealBegin" disabled/>
			  </u-form-item>
			  <u-form-item label="用章归还时间">
			    <u-input v-model="formData.sealEnd" disabled/>
			  </u-form-item>
			  <u-form-item label="所属合同">
			    <u-input v-model="formData.contractName" disabled/>
			  </u-form-item>
			  <u-form-item label="用章说明">
				<u-input v-model="formData.sealReason" disabled
			  /></u-form-item>
			  <u-form-item label="创建时间">
			    <u-input v-model="form.time" disabled />
			  </u-form-item>
			</u-form>
		</view>
	</template>
	
	<script>
		import auditApi from "../../api/audit.js";
		import getNameApi from "../../api/getName.js";
		export default {
			name:"reimbursement",
			props:['form'],
			data() {
				return {
					formData:{
						sealReason:'无',
						sealTypeName:'无',
						sealName:'无',
						contractName:'无',
						sealBegin:'无',
						sealEnd:'无'
					}
				};
			},
			mounted() {
				setTimeout(()=>{
					this.getData()
				},0)
			},
			methods:{
				async getData(){
					const res1 = await auditApi.getAuditDetail(
						{"X-Access-Token": this.$store.state.token},
						this.form.table)
					let {
					  sealType,
					  sealBy,
					  sealReason,
					  contractId,
					  sealBegin,
					  sealEnd,
					} = res1.data.result;
					this.formData.sealBegin = sealBegin
					this.formData.sealReason = sealReason
					this.formData.sealEnd = sealEnd
					//通过数字查询用章名称
					const sealTypeName = getNameApi.getSealTypeName(Number(sealType))
					this.formData.sealTypeName = sealTypeName
					//通过userName查询用户名称
					  if(sealBy){
						const res2 = await getNameApi.getUserName(
							{
							  "X-Access-Token": this.$store.state.token,
							},
							{username:sealBy}
						  )
						  this.formData.sealName = res2.data.result.records[0].realname
					  }
					
					//通过id查询获取合同名称
					  if(contractId){
						const res3 = await getNameApi.getContractName(
							{
							  "X-Access-Token": this.$store.state.token,
							},
							{id:contractId}
						  )
						  this.formData.contractName = res3.data.result.contractName
					  }
				}
			}
		}
	</script>
	
	<style scoped lang="scss">
	.container {
	  width: 90%;
	  margin: 0 auto;
	}
	</style>